CC=arm-apple-darwin9-gcc
LD=$(CC)
LDFLAGS= -L"usr/lib/" -F"/System/Library/Frameworks" -F"/System/Library/PrivateFrameworks" -bind_at_load
CFLAGS = -Wall -I/var/include
UI_OBJS = source/ui/main.o source/ui/STSpeaka.o source/ui/STSpeakaPreferences.o source/ui/ServiceTableCell.o source/ui/SpeakaServiceTableCell.o
DAEMON_OBJS= source/daemon/ispeakad.o

all:	package

iSpeaka: $(UI_OBJS)
	$(LD) $(LDFLAGS) -o $@ $^
	ldid -S iSpeaka

ispeakad: $(DAEMON_OBJS)
	$(LD) $(LDFLAGS) -o $@ $^

%.o:	%.m
	$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@

package: iSpeaka ispeakad
	rm -fr build
	mkdir -p build/iSpeaka.app
	cp -r ./resources/package/*.* ./build/iSpeaka.app
	cp ./resources/launchd/Library-LaunchDaemons/*.plist ./build/iSpeaka.app	
	mv iSpeaka ./build/iSpeaka.app
	mv ispeakad ./build/iSpeaka.app

clean:	
	rm -f source/ui/*.o iSpeaka
	rm -rf ./build
